package com.zzyl.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.zzyl.base.PageResponse;
import com.zzyl.mapper.CustomerProjectMapper;
import com.zzyl.service.CustomerProjectService;
import com.zzyl.vo.NursingProjectVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CustomerProjectServiceImpl implements CustomerProjectService {

    @Autowired
    private CustomerProjectMapper customerProjectMapper;

    /**
     * 分页查询所有项目
     *
     * @param name
     * @param pageNum
     * @param pageSize
     * @param status
     * @return
     */
    @Override
    public PageResponse<NursingProjectVo> list(String name, Integer pageNum, Integer pageSize, Integer status) {
        PageHelper.startPage(pageNum,pageSize);
        Page<NursingProjectVo> page = customerProjectMapper.list(name,status);
        NursingProjectVo nursingProjectVo = new NursingProjectVo();
        PageResponse response = PageResponse.of(page,nursingProjectVo.getClass());
        return response;
    }

    /**
     * 根据id获取服务项目数据
     *
     * @param id
     * @return
     */
    @Override
    public NursingProjectVo getById(Integer id) {
        NursingProjectVo nursingProjectVo = customerProjectMapper.getById(id);
        return nursingProjectVo;
    }
}
